<!DOCTYPE html>
    <html >
    <head>
        <meta charset="UTF-8">
        <title>键盘事件</title>
        <script>
                //e.code =>文字描述
                //e.keycode =>描述的是按键的ascii码
            document.onkeypress = function (e) {
              console.info(e.code + ":" + e.keyCode);
            };
        </script>
    </head>
    <body>

    </body>
</html>